/* 
 * File:   CalendarRenderer.h
 * Author: Muqtafi Akhmad
 *
 * Created on November 2, 2012, 7:27 AM
 */

#ifndef CALENDARRENDERER_H
#define	CALENDARRENDERER_H
#include <stdio.h>
#include <stdlib.h>
#ifdef _WIN32
#include <conio.h>
#endif
#include "../Calendar/Calendar.h"

#define DAY_IN_WEEK_MAX 7
#define WEEK_IN_MONTH_MAX 6
#define H_STRIP '-'
#define H_CELL "-------"
#define V_STRIP '|'
#define LEFT_KEY 97
#define RIGHT_KEY 100
#define ESC_KEY 27

class CalendarRenderer {
public:
    CalendarRenderer();
    CalendarRenderer(const CalendarRenderer&);
    CalendarRenderer(Calendar*, int, int);
    CalendarRenderer& operator=(const CalendarRenderer&);
    ~CalendarRenderer();
    /**
     * Returs reference to calendar
     * @param renderer calendar renderer
     * @return reference to calendar
     */
    Calendar * GetCalendar();
    /**
     * Returns current month of renderer
     * @param renderer renderer
     * @return current month
     */
    int GetCurrentMonth();
    /**
     * Returns current year of renderer
     * @param renderer renderer
     * @return current year
     */
    int GetCurrentYear();
    /**
     * Set calendar of renderer
     * @param renderer renderer
     * @param calendar calendar
     */
    void SetCalendar(Calendar *calendar);
    /**
     * Set current month of renderer
     * @param renderer renderer
     * @param month current month
     */
    void SetCurrentMonth(int month);
    /**
     * Set current year of renderer
     * @param renderer renderer
     * @param year current year
     */
    void SetCurrentYear(int year);
    /**
     * Move current month to next month
     * @param renderer renderer
     */
    void AdvanceMonth();
    /**
     * Move current month to previous month
     * @param renderer
     */
    void BackMonth();
    /**
     * Render the calendar for the current month and year
     * @param renderer
     */
    void RenderCalendar();
    /**
     * Print end line
     */
    void EndLine();
    /**
     * Print horizontal line
     */
    void PrintHLine();
    /**
     * Show events count in a month as table
     * @param calendar the calendar
     * @param args year and month of calendar
     */
    void ShowCalendar(char**args);
    
private:
    Calendar *calendar; // reference to calendar 
    int currentMonth; // the current rendered month
    int currentYear; // the current rendered year
};

#endif	/* CALENDARRENDERER_H */

